import Page
from Page import Music
from Base.Base import Base
from selenium.webdriver.common.by import By


class MusicChoicePage(Base):
    """
    音乐-偏好选择页面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 偏好选择标题, 文案: 你都喜欢听些什么音乐？
        self.choice_title_text = (By.XPATH, Music.RESOURCE_ID.format("tvTitle"))

        # 跳过按钮
        self.choice_skip_btn = (By.XPATH, Music.RESOURCE_ID.format("tvSkip"))

    def click_skip(self):
        """
        点击偏好选择页的跳过

        :return: None
        """
        if self.is_display_title():
            self.click_element(self.choice_skip_btn)

    def is_display_title(self):
        """
        是否存在偏好选择页的标题

        :return: bool
        """
        return self.is_display(self.choice_title_text)


if __name__ == '__main__':
    pass
